package be.esi.athanfree.gui.panel;

import be.esi.athanfree.modele.AthanModele;
import java.util.Observable;
import java.util.Observer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JUi.java
 *
 * Created on 24 févr. 2012, 22:49:37
 */
/**
 *
 * @author Aladin
 */
public class HPPanel extends javax.swing.JPanel implements Observer {

    /** Creates new form JUi */
    public HPPanel() {
        initComponents();
    }
    
    public void setModele(AthanModele modele){
        this.modele = modele;
        this.modele.addObserver(this);
         update(null, null);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        heureLabel = new javax.swing.JLabel();
        heureLabelValue = new javax.swing.JLabel();
        jLFajrName = new javax.swing.JLabel();
        jLFajrValue = new javax.swing.JLabel();
        jLDohrName = new javax.swing.JLabel();
        jLDohrValue = new javax.swing.JLabel();
        jLAsrName = new javax.swing.JLabel();
        jLAsrValue = new javax.swing.JLabel();
        jLMaghrebName = new javax.swing.JLabel();
        jLMagrhebValue = new javax.swing.JLabel();
        jLIchaName = new javax.swing.JLabel();
        jLIchaValue = new javax.swing.JLabel();

        setLayout(new java.awt.GridLayout(0, 2));

        heureLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        heureLabel.setText("Heure");
        add(heureLabel);

        heureLabelValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        heureLabelValue.setText("00:00");
        add(heureLabelValue);

        jLFajrName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLFajrName.setText("Fajr");
        add(jLFajrName);

        jLFajrValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLFajrValue.setText("00 : 00");
        add(jLFajrValue);

        jLDohrName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLDohrName.setText("Dohr");
        add(jLDohrName);

        jLDohrValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLDohrValue.setText("00 : 00");
        add(jLDohrValue);

        jLAsrName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLAsrName.setText("Asr");
        add(jLAsrName);

        jLAsrValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLAsrValue.setText("00 : 00");
        add(jLAsrValue);

        jLMaghrebName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLMaghrebName.setText("Maghreb");
        add(jLMaghrebName);

        jLMagrhebValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLMagrhebValue.setText("00 : 00");
        add(jLMagrhebValue);

        jLIchaName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLIchaName.setText("Icha");
        add(jLIchaName);

        jLIchaValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLIchaValue.setText("00 : 00");
        add(jLIchaValue);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel heureLabel;
    private javax.swing.JLabel heureLabelValue;
    private javax.swing.JLabel jLAsrName;
    private javax.swing.JLabel jLAsrValue;
    private javax.swing.JLabel jLDohrName;
    private javax.swing.JLabel jLDohrValue;
    private javax.swing.JLabel jLFajrName;
    private javax.swing.JLabel jLFajrValue;
    private javax.swing.JLabel jLIchaName;
    private javax.swing.JLabel jLIchaValue;
    private javax.swing.JLabel jLMaghrebName;
    private javax.swing.JLabel jLMagrhebValue;
    // End of variables declaration//GEN-END:variables
    private AthanModele modele;
    @Override
    public void update(Observable o, Object arg) {
        heureLabelValue.setText(modele.getHeure());
        jLFajrValue.setText(""+modele.getPrayers().fajr().getHour()+" : "+modele.getPrayers().fajr().getMinute());
        jLDohrValue.setText(""+modele.getPrayers().duhr().getHour()+" : "+modele.getPrayers().duhr().getMinute());
        jLAsrValue.setText(""+modele.getPrayers().assr().getHour()+" : "+modele.getPrayers().assr().getMinute());
        jLMagrhebValue.setText(""+modele.getPrayers().maghrib().getHour()+" : "+modele.getPrayers().maghrib().getMinute());
        jLIchaValue.setText(""+modele.getPrayers().ishaa().getHour()+" : "+modele.getPrayers().ishaa().getMinute());
    }
}